package org.mogoo.simple.socket;

import java.io.*;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Author: Fang
 * Date: 2012-08-21
 * Time: 15:37
 * Email: dongfang@mogoo.org
 */
public class Client
{
    public static void main(String[] args) throws Exception
    {

        InetAddress inetAddress = InetAddress.getByAddress(new byte[]{127,0,0,1});
        Socket socket = new Socket("127.0.0.1",8888);
        BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        int hasRead = 0;
        char[] buff = new char[1024];
        while((hasRead = br.read(buff)) > 0)
        {
            System.out.print(new String(buff, 0, hasRead));
        }
        br.close();
        socket.close();

    }
}

